﻿<Window x:Class="WpfControls.FontChooser"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:app="clr-namespace:WpfControls" 
    Title="Font Chooser" 
    Icon="Resources\Font.ico"
    Width="800" Height="800"
    Background="{x:Static SystemColors.ControlBrush}"
    >
    <Grid Margin="12">
        <Grid.RowDefinitions>
            <RowDefinition Height="4*"/>
            <RowDefinition Height="3*"/>
            <RowDefinition Height="2*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <!-- Row 0: Selection controls -->
        <Grid Grid.Column="0" Grid.Row="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="3*"/>
                <ColumnDefinition Width="12"/>
                <ColumnDefinition Width="2*"/>
                <ColumnDefinition Width="12"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>

            <!-- Families -->
            <Label Grid.Column="0" Grid.Row="0" Content="_Font family"/>
            <DockPanel Grid.Column="0" Grid.Row="1" Grid.RowSpan="3">
                <TextBox DockPanel.Dock="Top" Name="fontFamilyTextBox"/>
                <ListBox Name="fontFamilyList"/>
            </DockPanel>

            <!-- Family Typefaces (weight, style, stretch) -->
            <Label Grid.Column="2" Grid.Row="0" Grid.ColumnSpan="3" Content="_Typeface:"/>
            <ListBox Grid.Column="2" Grid.Row="1" Grid.ColumnSpan="3" Name="typefaceList"/>

            <!-- Font sizes -->
            <Label Grid.Column="2" Grid.Row="2" Margin="0,12,0,0" Content="_Size:"/>
            <DockPanel Grid.Column="2" Grid.Row="3">
                <TextBox DockPanel.Dock="Top" Name="sizeTextBox"/>
                <ListBox Height="60" Name="sizeList"/>
            </DockPanel>

            <!-- Text decorations -->
            <DockPanel Grid.Column="4" Grid.Row="3">
                <CheckBox DockPanel.Dock="Top" Content="Underline" Name="underlineCheckBox"/>
                <CheckBox DockPanel.Dock="Top" Content="Baseline" Name="baselineCheckBox"/>
                <CheckBox DockPanel.Dock="Top" Content="Strikethrough" Name="strikethroughCheckBox"/>
                <CheckBox Content="Overline" Name="overlineCheckBox"/>
            </DockPanel>
        </Grid>

        <!-- Row 1: Tab control with family typeface samples, etc. -->
        <TabControl Grid.Column="0" Grid.Row="1" Margin="0,12,0,0" Name="tabControl">
            <TabItem Header="Family and typeface samples" Name="samplesTab">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition Width="12"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    
                    <TextBlock Grid.Column="0" Grid.Row="0">
                        <Run>FontFamily: </Run>
                        <Run Name="fontFamilyNameRun"/>
                    </TextBlock>
                    <RichTextBox 
                        Grid.Column="0" Grid.Row="1" 
                        IsReadOnly="True" 
                        VerticalScrollBarVisibility="Auto"
                        Name="fontFamilySamples"
                        />
                    <TextBlock Grid.Column="2" Grid.Row="0">
                        <Run>Typeface: </Run>
                        <Run Name="typefaceNameRun">Points</Run>
                    </TextBlock>
                    <RichTextBox 
                        Grid.Column="2" Grid.Row="1" 
                        IsReadOnly="True" 
                        VerticalScrollBarVisibility="Auto"
                        Name="typefaceSamples"
                        />
                </Grid>
            </TabItem>
            <TabItem Header="Typographic Features" Name="typographyTab">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="8"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>

                    <!-- Feature list of left-hand side of typography tab -->
                    <Label Grid.Column="0" Grid.Row="0" Content="Feature"/>
                    <ListBox Grid.Column="0" Grid.Row="1" Name="featureList" MinWidth="192"/>

                    <!-- Column headers on right-hand side of typography tab -->
                    <Grid Grid.Column="2" Grid.Row="0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="1"/>
                            <ColumnDefinition Width="96"/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Label Grid.Column="1" Content="Selection"/>
                        <Label Grid.Column="2" Content="Sample"/>
                    </Grid>

                    <!-- Feature page -->
                    <Border Grid.Column="2" Grid.Row="1" BorderThickness="1" BorderBrush="{x:Static SystemColors.ControlDarkDarkBrush}">
                        <ScrollViewer VerticalScrollBarVisibility="Auto">
                            <Grid Name="typographyFeaturePage">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="96"/>
                                    <ColumnDefinition/>
                                    <!-- The grid contents for each feature are filled in programmatically -->
                                </Grid.ColumnDefinitions>
                            </Grid>
                        </ScrollViewer>
                    </Border>
                </Grid>
            </TabItem>
            <TabItem Header="DescriptiveText" Name="descriptiveTextTab">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="3*"/>
                        <ColumnDefinition Width="8"/>
                        <ColumnDefinition Width="2*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    
                    <Label Grid.Column="0" Grid.Row="0" Content="Font description:"/>
                    <RichTextBox 
                        Grid.Column="0" Grid.Row="1" 
                        IsReadOnly="True" 
                        VerticalScrollBarVisibility="Auto"
                        Name="fontDescriptionBox"
                        />
                    
                    <Label Grid.Column="2" Grid.Row="0" Content="License:"/>
                    <TextBox 
                        Grid.Column="2" Grid.Row="1" 
                        IsReadOnly="True" 
                        TextWrapping="WrapWithOverflow" 
                        VerticalScrollBarVisibility="Auto" 
                        Name="fontLicenseBox"
                        />
                </Grid>
            </TabItem>
        </TabControl>

        <!-- Row 2: Preview text -->
        <DockPanel Grid.Column="0" Grid.Row="2" Margin="0,12,0,0">
            <TextBlock DockPanel.Dock="Top">Preview:</TextBlock>
            <TextBox
                FontSize="16" AcceptsReturn="True" 
                TextAlignment="Center" 
                TextWrapping="Wrap"
                VerticalScrollBarVisibility="Auto"
                Name="previewTextBox"
                >
                The quick brown fox jumps over the lazy dog
            </TextBox>
        </DockPanel>

        <!-- Row 3: OK and Cancel buttons -->
        <StackPanel Grid.Column="0" Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,12,0,0">
            <Button Content="OK" Width="86" IsDefault="True" Click="OnOKButtonClicked" Margin="3,0,0,0"/>
            <Button Content="Cancel" Width="86" Click="OnCancelButtonClicked" Margin="3,0,0,0"/>
        </StackPanel>

    </Grid>
</Window>
